package com.VisualDisp.QuadCalculateProject.VisualDisplay;

import org.eclipse.swt.widgets.Text;
import com.VisualDisp.QuadCalculateProject.Calculations.Equations.Expressions;
import com.VisualDisp.QuadCalculateProject.Calculations.Equations.Result;

public class MainDowShell {

	private Expressions expr;
	private Text textEQ,textTY,res1,res2;
	
	public MainDowShell(double a, double b, double c,Text equa, Text type, Text x1, Text x2)
	{
		expr = new Expressions(a, b, c);
		textEQ = equa;
		textTY = type;
		res1 = x1; 
		res2 = x2;
	}
	
	public void doWork()
	{
		textEQ.setText(expr.getSEquation());
		textTY.setText(expr.getType());
		Result temp = expr.getResult();
		if(temp != null )
		{
			res1.setText(temp.getX1()+"");
			res2.setText(temp.getX2()+"");
		}
		else
		{
			res1.setText("NAN");
			res2.setText("NAN");
		}		
	}
	
	public Expressions getExpression()
	{
		return this.expr;
	}
	
}
